﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">Id</th>
                <td class="formValue">
                    <input id="Id" name="Id" type="text" class="form-control required" placeholder="" />
                </td>
                <th class="formTitle">ParentId</th>
                <td class="formValue">
                    <input id="ParentId" name="ParentId" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">名称</th>
                <td class="formValue">
                    <input id="FullName" name="FullName" type="text" class="form-control required" />
                </td>
                <th class="formTitle">简称</th>
                <td class="formValue">
                    <input id="ShortName" name="ShortName" type="text" class="form-control required" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">编码</th>
                <td class="formValue">
                    <input id="EnCode" name="EnCode" type="text" class="form-control required" />
                </td>
                <th class="formTitle">层级</th>
                <td class="formValue">
                    <input id="Layers" name="Layers" type="text" class="form-control required" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">城市编码</th>
                <td class="formValue">
                    <input id="CityCode" name="CityCode" type="text" class="form-control" />
                </td>
                <th class="formTitle">邮政编码</th>
                <td class="formValue">
                    <input id="ZipCode" name="ZipCode" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">经度</th>
                <td class="formValue">
                    <input id="Longitude" name="Longitude" type="text" class="form-control" />
                </td>
                <th class="formTitle">纬度</th>
                <td class="formValue">
                    <input id="Latitude" name="Latitude" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">全拼</th>
                <td class="formValue">
                    <input id="FullSpell" name="FullSpell" type="text" class="form-control" />
                </td>
                <th class="formTitle">首拼</th>
                <td class="formValue">
                    <input id="FirstSpell" name="FirstSpell" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">聚合名称</th>
                <td class="formValue" colspan="3">
                    <input id="MergerName" name="MergerName" type="text" class="form-control required" />
                </td>
            </tr>
        </table>
    </div>
</form>

<script>
    var keyValue = $.request("keyValue");
    $(function () {
        initControl();
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/Region/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });
    function initControl() {

    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/SystemManage/Region/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>